home *** CD-ROM | disk | FTP | other *** search
/ Aminet 12 / Aminet 12 (1996)(GTI - Schatztruhe)[!][Jun 1996].iso / Aminet / dev / lang / HeliOS4.lha / helios_demo_disk4 / docs / userinterface / StandAlonePrograms.doc < prev    next >
Encoding:
Text File  |  1996-02-26  |  18.1 KB  |  454 lines

  1.  
  2.         *********************************************
  3.         Producing StandAlone Applications with HeliOS
  4.         *********************************************
  5.  
  6. Before reading the text below you might like to read "Compilation.doc"
  7. for a general introduction to the processes of compiling and executing
  8. HeliOS programs.
  9.  
  10. The main HeliOS intepreter is not only used to run HeliOS programs:
  11. it can also save out HeliOS programs in various formats.  To do this
  12. it uses a configurable Interpreter menu function called PRESAVE.
  13.  
  14. The HeliOS system is unlike other programming languages in that its
  15. executable output does not always necessarily consist of a single file,
  16. but can also employ a system using a standalone "executive module" in
  17. conjunction with program "overlay" files.
  18.  
  19. The main HeliOS Interpreter program has menu options to configure
  20. the PRESAVE output compilation process into three distinct modes:
  21.  
  22. 1 -> Compile dictionary
  23.  
  24. 2 -> Compile overlay
  25.  
  26. 3 -> Compile standalone
  27.  
  28. These options cause the PRESAVE function to save different kinds of
  29. program files as follows:
  30.  
  31. Compile dictionary - This causes TWO files to be generated and saved by 
  32.                      the PRESAVE function.
  33.  
  34.                      These files are a main program overlay file and a
  35.                      vocabulary overlay file for use when the program
  36.                      is to be PRELOADED back into the main Interpreter.
  37.  
  38.                      In this process the vital information which makes
  39.                      up a HeliOS program is split into two parts, one
  40.                      containing the program code itself, and the other
  41.                      containing "vocabulary" information required for
  42.                      the Interpreter to be able to associate keyboard
  43.                      input with functions defined within the program.
  44.  
  45.                      When using the standalone compiler "HeliOS_cmp"
  46.                      the main program file is given a ".cmp" suffix,
  47.                      and the vocabulary file a ".cmpv" suffix, but in
  48.                      the case where you are compiling from the main 
  49.                      interpreter the "cmp" part is omitted.  This allows
  50.                      you to specify the exact filename you prefer for 
  51.                      the main program file, and the interpreter/compiler
  52.                      simply add a "V" suffix to the vocabulary file.
  53.                      Both of the compiled files should be kept together, 
  54.                      and both will be automatically loaded when you use 
  55.                      the PRELOAD function on the main program file.
  56.  
  57.                      Note that when using the PRELOAD function you only
  58.                      need select the main compiled program file, because 
  59.                      the vocabulary file will be automatically loaded at 
  60.                      the same time by the HeliOS system.
  61.  
  62. Compile overlay    - This causes a single file to be generated for use
  63.                      with the "HeliOS_exe" standalone executive program:
  64.                      this file simply contains the program code in a
  65.                      concisely packed form.
  66.  
  67.                      The standalone executive does not make any use of
  68.                      vocabulary information, so it only requires the
  69.                      program code overlay.
  70.  
  71.                      A file (called, for example, MyProgram) generated
  72.                      in this way from the Interpreter can be run using
  73.                      the HeliOS_exe "executive" in the following manner:
  74.  
  75.                      HeliOS_exe MyProgram
  76.  
  77.                      This allows the one "executive" program containing
  78.                      all the HeliOS support code to be used to run any
  79.                      number of HeliOS program files, each of which is
  80.                      very small and contains only the specific code
  81.                      relating to the program itself.
  82.  
  83. Compile standalone - This causes a single executable file to be generated,
  84.                      which can be run directly on its own.
  85.  
  86.                      This option reveals perhaps the main "negative trade
  87.                      off" which the design of the HeliOS system has forced
  88.                      upon us.  The problem is that all HeliOS executables
  89.                      must contain ALL the HeliOS support code, and thus are
  90.                      quite large at around 250k each.  In fact ALL HeliOS
  91.                      executables are exactly the same size, and consist of
  92.                      the HeliOS "executive" program with the program code
  93.                      already embedded within it.
  94.  
  95.                      This large size is only a real problem if you want to
  96.                      include several HeliOS programs together on a disk.
  97.                      In this case it would be much better to use the second
  98.                      option mentioned above: to have one HeliOS "executive"
  99.                      and several small overlay program files.
  100.  
  101.  
  102. The simple single executable HeliOS program can only be generated from
  103. the main Interpreter, and its use is quite self-explanatory.
  104.  
  105. HeliOS overlay files can be generated also by using a standalone compiler
  106. called HeliOS_cmp, and we will below enter into a detailed discussion of
  107. the use of this compiler and its associated "executive module" HeliOS_exe.
  108.  
  109.  
  110. *************************
  111. HeliOS_cmp and HeliOS_exe
  112. *************************
  113.  
  114. The full HeliOS system consists of the integrated interpreter/compiler
  115. program called "HeliOS_int" and two smaller programs which act as a
  116. stand-alone compiler (called "HeliOS_cmp") and an executive (called
  117. "HeliOS_exe").
  118.  
  119. * WARNING!
  120.  
  121. The "HeliOS_exe" file is an ordinary AmigaDOS executable file which is
  122. provided on your HeliOS master disks in uncompressed form.  If you wish,
  123. you may use a packer such as PowerPacker to compress this executable into
  124. a file somewhat less than half the size of the original, thus enabling you
  125. to save space on any of your HeliOS program disks which run HeliOS overlay
  126. files using HeliOS_exe.
  127.  
  128. Please note however that the copy of "HeliOS_exe" which resides in your
  129. master "HeliOS:" directory MUST NOT BE PACKED.  This is because this file
  130. is used in its UNPACKED form by the main HeliOS Interpreter program when
  131. it is creating standalone executables.  If you pack the "HeliOS_exe" file
  132. which is in the HeliOS: directory you will find that all standalone HeliOS
  133. programs created from the Interpreter will not work at all.
  134.  
  135.  
  136. ***************************
  137. Simple useage of HeliOS_cmp
  138. ***************************
  139.  
  140. You can compile any HeliOS source code using the stand-alone compiler,
  141. HeliOS_cmp, using an AmigaDOS command line such as:
  142.  
  143. HeliOS_cmp HeliOS:MyPrograms/MySourceCode
  144.            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  145.    Single command line parameter = name of the HeliOS source code
  146.  
  147. The use of HeliOS_cmp will create two new files which will be stored in
  148. the same path as the original source code file, and are based on the
  149. original source code filename with additional suffixes:
  150.  
  151. 1. The first file will be called "MySourceCode.cmp", and is a compiled
  152.    HeliOS program module.
  153.  
  154.    This file always has the suffix ".cmp".
  155.  
  156. 2. The second file will be called "MySourceCode.cmpV", and is a compiled
  157.    HeliOS vocabulary module
  158.  
  159.    This file always has the suffix ".cmpV".
  160.  
  161.  
  162. ***************************
  163. Simple useage of HeliOS_exe
  164. ***************************
  165.  
  166. The compiled program module (the file with the ".cmp" suffix) generated
  167. using HeliOS_cmp as described above can be executed by using the stand-
  168. alone HeliOS executive program, HeliOS_exe.
  169.  
  170. The HeliOS_exe program is used from an AmigaDOS command line with a single
  171. parameter, like this:
  172.  
  173. HeliOS_exe HeliOS:MyPrograms/MySourceCode.cmp
  174.            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  175.   Single command line parameter = name of the HeliOS compiled code module
  176.  
  177. Although the HeliOS_cmp program generates by default a program module with
  178. a ".cmp" suffix to its filename, this name can be changed before using
  179. the file with HeliOS_exe.  In other words, HeliOS_exe does NOT require any
  180. special filename format for its program module filename parameter.
  181.  
  182. N.B.
  183.  
  184. The use of HeliOS_exe does not require the vocabulary module, which is
  185. only needed when you are using the full HeliOS interpreter.
  186.  
  187. The compiled vocabulary module is used automatically by HeliOS when
  188. PRELOADING the compiled program into the main HeliOS interpreter.
  189.  
  190.  
  191. ****************************
  192. Special useage of HeliOS_cmp
  193. ****************************
  194.  
  195. As stated above, the normal simple useage of HeliOS_cmp is:
  196.  
  197. HeliOS_cmp SourceFile
  198.  
  199. Also as stated above, this simple useage takes as a single parameter the
  200. filename of the source code file which you wish to compile, and creates
  201. a compiled code module and a vocabulary module.  These "module" files
  202. have the same name as the original file but with ".cmp" and ".cmpV" as
  203. filename suffixes.
  204.  
  205. For more flexible use of HeliOS_cmp you can specify various different
  206. actions by using extra command line parameters:
  207.  
  208. 1. You can specify your own specific output filename and path.
  209.  
  210.    To do this you must specify the target output filename (with path) as
  211.    a second command line parameter placed after the source file name, like
  212.    this:
  213.  
  214.    HeliOS_cmp SourceFile TargetFile
  215.                          ^^^^^^^^^^
  216.                          2nd parameter = Target output filename and path
  217.  
  218.    If you do not specify a full path, HeliOS will save the output file to
  219.    the current directory.
  220.  
  221.    In this case HeliOS_cmp will open a 4-colour screen.
  222.  
  223.    In this case a final end-of-compilation message and a free bytes
  224.    statement will apppear.
  225.  
  226. 2. You can specify that no vocabulary module file is created.
  227.  
  228.    To do this you must specify the command line switch "-v" after the
  229.    other command line parameters:
  230.  
  231.    HeliOS_cmp SourceFile -v
  232.                          ^^
  233.                          Specifies no vocabulary module file
  234.  
  235.    HeliOS_cmp SourceFile TargetFile -v
  236.                                     ^^
  237.                                     Specifies no vocabulary module file
  238.  
  239.    In this case HeliOS_cmp will open a 4-colour screen.
  240.  
  241.    In this case a final end-of-compilation message and a free bytes
  242.    statement will apppear.
  243.  
  244. 3. You can specify that no output files at all are created.
  245.  
  246.    To do this you must specify the command line parameter "NULL" as the
  247.    second parameter:
  248.  
  249.    HeliOS_cmp SourceFile NULL
  250.                          ^^^
  251.                          Specifies no output module files at all
  252.    or
  253.  
  254.    HeliOS_cmp SourceFile null
  255.                          ^^^
  256.                          Specifies no output module files at all
  257.  
  258.    Note that the "NULL" parameter may be specified in upper or lower case.
  259.  
  260.    In this case HeliOS_cmp will open an 8-colour screen and set its colours
  261.    to your default HeliOS colour settings.
  262.  
  263.    In this case the final end-of-compilation message and the free bytes
  264.    statement will not apppear.
  265.  
  266.    This mode of operation allows you to use the HeliOS_cmp program to
  267.    execute source code "cleanly", with no output files created, for the
  268.    purpose of running code outside the main interprter.  In effect this
  269.    can be used as a method of "executing" HeliOS source code, since the
  270.    compiler can be caused by the source code itself to evoke the final 
  271.    run time program.
  272.  
  273. ****************************************
  274. Editing and compiling HeliOS source code
  275. ****************************************
  276.  
  277. Normally it is convenient to develop your code using the interactive
  278. HeliOS system.
  279.  
  280. Alternatively, if you prefer to do so, you can use a separate text editor
  281. to produce your source code and then compile and run it using the HeliOS
  282. standalone compiler/executive.
  283.  
  284. Whatever you do, you MUST use the stand-alone compiler if you intend to
  285. redistribute your programs.
  286.  
  287. Failure to comply with this is an infringement of Helios copyright - you
  288. MUST NOT redistribute the full HeliOS interpreter/compiler.
  289.  
  290. ********************************************************
  291. A note on saving and loading HeliOS Interpreter programs
  292. ********************************************************
  293.  
  294. The HeliOS menu functions PRESAVE and PRELOAD are used to save and load
  295. the current state of the HeliOS system.
  296.  
  297. When the PRELOAD function is used, the HeliOS system automatically runs
  298. the last word which was compiled in the dictionary before PRESAVEing.
  299.  
  300. This gives you the option of "autorunning" programs, but if you do not
  301. want your program to do anything when it loads you can simply include a
  302. last word definition which does nothing.
  303.  
  304. Like Forth, HeliOS programs consist of a code section and a section used
  305. to store the interpreter's vocabulary reference material, but HeliOS has
  306. a different method of organising its dictionary to standard Forth systems.
  307.  
  308. HeliOS stores all textual "name" information outside the main dictionary
  309. in a separate module, and incidentally employs a hashing system with
  310. multi-path searching to achieve very fast compilation.
  311.  
  312. When you save out a "precompiled" module from the main interpreter, two
  313. files are always generated, one of which is a vocabulary text module, and
  314. the other contains compiled HeliOS code.  This is also the case when you
  315. use the HeliOS_cmp compiler program in its default mode of operation.
  316.  
  317. The compiled code module will be given the name which you specify, and
  318. the vocabulary module will have the same name with a "V" suffix added.
  319.  
  320. In order to reload a precompiled module ino the interpreter you must
  321. select and load the CODE file, and the "V" file will automatically be
  322. picked up and loaded by HeliOS.
  323.  
  324. If the "V" file is not available the module will not load into the HeliOS
  325. interpreter, so remember to move both files if you are transferring your 
  326. code from one disk to another.
  327.  
  328. *********
  329. IMPORTANT
  330. *********
  331.  
  332. Remember: when using the main interpreter, compiled modules employ TWO
  333. files, one of which is a vocabulary text module.
  334.  
  335. The stand-alone executive HeliOS_exe does NOT require a vocabulary module.
  336.  
  337. **********************************************
  338. Saving and loading HeliOS Stand-Alone programs
  339. **********************************************
  340.  
  341. The stand-alone compiler operates differently from the Interpreter in that
  342. the vocabulary name information is discarded after compilation, leaving a
  343. single very compact code module.  This single code module is then loaded
  344. by the HeliOS executive program and runs your code.
  345.  
  346. So, when using the stand-alone compiler/executive, compiled modules employ
  347. only ONE file.
  348.  
  349. Another important point to remember when designing stand-alone code is that
  350. the main HeliOS interpreter screen environment, file requester, and editor
  351. WILL NOT BE AVAILABLE!
  352.  
  353. * In stand-alone code you MUST set up a screen display for your output, and
  354. you must not rely on the HeliOS file requester or editor being available.
  355.  
  356. * Remember also that no vocabulary name information will be available, so do
  357. not use code which relies on this at run time: dictionary searches are not
  358. possible when the vocabulary name information has been removed!
  359.  
  360. * It will also be necessary to explicitly load any include files needed by
  361. using a command within the program, since the HeliOS interpreter with its
  362. preloaded include files is not available.
  363.  
  364. *************************************
  365. Using the HeliOS stand-alone compiler
  366. *************************************
  367.  
  368. The stand-alone compiler is invoked from the CLI by typing its program
  369. name (ie. "HeliOS_cmp") followed by the name of your source code file
  370. and possibly other parameters as specified above.
  371.  
  372. The compiler will present you with a full screen window and will proceed
  373. to compile your code.
  374.  
  375. Any errors will be reported in the window, with the usual information on
  376. the type and position of the the error.
  377.  
  378. Finally, you will be given a statement of how much dictionary space is
  379. still available, and then the compiler waits for you to click in the
  380. screen to indicate that you are ready to go on.
  381.  
  382. Assuming the compilation is successful the compiler will generate a file
  383. with the same name and in the same path as your original source file but
  384. with a ".cmp" suffix (as default action, but see above for special use).
  385.  
  386.  
  387. **************************************
  388. Using the HeliOS stand-alone executive
  389. **************************************
  390.  
  391. To run your compiled code you must type at the CLI the name of the HeliOS
  392. executive program (ie. "HeliOS_exe") followed by the name of the compiled
  393. code file.
  394.  
  395. Remember that you do not have to retain the ".cmp" suffix on the compiled
  396. file, which was merely added for identification purposes by the compiler.
  397.  
  398.  
  399. ************************************
  400. Start up procedure for compiled code
  401. ************************************
  402.  
  403. When precompiled code is run by HeliOS, the last (topmost) word in the
  404. dictionary is automatically executed.
  405.  
  406. This gives you the opportunity to automatically start your program, and
  407. is necessary when using standalone modules.
  408.  
  409. See above for a discussion of this feature when applied to PRESAVEing
  410. and PRELOADing code in the Interpreter environment.
  411.  
  412.  
  413. *******
  414. Summary
  415. *******
  416.  
  417.   The main interpreter/compiler saves and loads twin-file modules
  418.  
  419.   The standalone compiler/executive saves and loads single file modules
  420.   but can also generate vocabulary modules if required
  421.  
  422.   Modules generated from the interpreter and the stand-alone compiler are
  423.   NOT necessarily interchangeable
  424.  
  425.   The standalone compiler/executive code cannot use the standard HeliOS
  426.   Interpreter screen/window output, the HeliOS FileIO requester, the
  427.   HeliOS editors, or any run time vocabulary access.
  428.  
  429.   The standalone compiler/executive code must specify and load any include
  430.   files required in an explicit statement within the program.
  431.  
  432.   The main interpreter/compiler is called "HeliOS_int"
  433.  
  434.   The stand-alone compiler is called "HeliOS_cmp"
  435.  
  436.   The stand-alone executive is called "HeliOS_exe"
  437.  
  438.   "HeliOS_cmp" and "HeliOS_exe" may be invoked from the CLI followed by
  439.   simple command line parameters as specified above.
  440.  
  441.   When running precompiled code HeliOS automatically executes the top word
  442.   in the dictionary, giving you control over startup execution.
  443.  
  444.   You can use the above feature to customise your startup environment in
  445.   the interpreter.
  446.  
  447.   In the main interpreter there is a menu allowing the compilation, saving,
  448.   and loading of complete code modules: this process is referred to as
  449.   PRESAVEing and PRELOADing.
  450.  
  451. ************************************************************************
  452. End
  453. ************************************************************************
  454.